package com.ruoyi.web.controller.tool;





import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import fr.opensagres.poi.xwpf.converter.pdf.PdfConverter;
import fr.opensagres.poi.xwpf.converter.pdf.PdfOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;


import java.io.*;


/**
 * @author weixinxin 2024-01-25
 **/

public class WordToPdf {



    //测试
    public static void main(String[] args) throws IOException {

        FileInputStream fileInputStream = new FileInputStream("C:\\Users\\Administrator\\Desktop\\二中\\test.docx");
        XWPFDocument xwpfDocument = new XWPFDocument(fileInputStream);

        PdfOptions pdfOptions = PdfOptions.create();
        FileOutputStream fileOutputStream = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\二中\\（第二次挂网稿）JXDY2024-HW-F0027-1南昌市第二中学智慧校园门锁安全管理系统采购项目_54971(3).pdf");
        PdfConverter.getInstance().convert(xwpfDocument,fileOutputStream,pdfOptions);
        fileInputStream.close();
        fileOutputStream.close();
    }




}
